package com.fh.service.ccode;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.util.PageData;

@Service("missionService")
public class MissionService {

	@Resource(name = "daoSupport")
	private DaoSupport dao;

	/*
	*获取首页当前任务列表
	*/
	@SuppressWarnings("unchecked")
	public List<PageData> getMissionListHome(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("MissionsMapper.getMissionList", pd);
	}
	
	/*
	*添加新任务
	*/
	public void addMission(PageData pd) throws Exception{
		dao.save("MissionsMapper.saveMission", pd);
	}

	@SuppressWarnings("unchecked")
	public List<PageData> getClassifications(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("MissionsMapper.getClassifications", pd);
	}
	
	@SuppressWarnings("unchecked")
	public List<PageData> getAreas(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("MissionsMapper.getAreas", pd);
	}

	public PageData findMissionByID(PageData pd) throws Exception {
		return (PageData)dao.findForObject("MissionsMapper.findMissionByID", pd);
	}

	public void delMission(PageData pd) throws Exception{
		dao.delete("MissionsMapper.delMission", pd);
	}
	
	public void addComment(PageData pd) throws Exception{
		dao.save("MissionsMapper.saveComment", pd);		
	}

	@SuppressWarnings("unchecked")
	public List<PageData> getMiComments(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("MissionsMapper.getMiComments", pd);
	}

	public PageData getMissionJoinNum(PageData pd) throws Exception{
		return (PageData) dao.findForObject("MissionsMapper.getMissionJoinNum", pd);
	}
	
}
